package com.bckj.fastboot.core.web.repeat;

import com.bckj.fastboot.core.redis.RedisOps;
import com.bckj.fastboot.core.web.repeat.strategy.RepeatSubmitStrategy;
import com.bckj.fastboot.core.web.repeat.strategy.SameTokenRepeatSubmitStrategy;
import com.bckj.fastboot.core.web.repeat.strategy.SameUrlDataRepeatSubmitStrategy;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;

/**
 * RepeatConfiguration
 *
 * @author wfc
 **/
@AutoConfiguration
public class RepeatConfiguration {


    @Bean
    @ConditionalOnBean(RedisOps.class)
    public SameTokenRepeatSubmitStrategy sameTokenRepeatSubmitStrategy(RedisOps redisOps) {
        return new SameTokenRepeatSubmitStrategy(redisOps);
    }

    @Bean
    @ConditionalOnBean(RedisOps.class)
    public RepeatSubmitStrategy sameUrlDataRepeatSubmitStrategy(RedisOps redisOps) {
        return new SameUrlDataRepeatSubmitStrategy(redisOps);
    }
}
